# 参数选择比例敏感性
gamma = [0.1, 0.2, 0.3, 0.4, 0.5]  # Top-γ% 参数
accuracy = [72.5, 78.3, 80.1, 79.8, 79.5]  # 精度 (%)
comm_reduction = [88.2, 82.5, 76.3, 70.1, 65.0]  # 通信压缩率 (%)

plt.figure(figsize=(10, 6))
plt.plot(gamma, accuracy, 'bo-', label='Accuracy')
plt.xlabel(r'Parameter Selection Ratio $\gamma$ (%)', fontsize=12)
plt.ylabel('Accuracy (%)', fontsize=12)
plt.ylim(70, 85)

ax2 = plt.twinx()
ax2.plot(gamma, comm_reduction, 'rs--', label='Communication Reduction')
ax2.set_ylabel('Communication Reduction (%)', color='r', fontsize=12)
ax2.tick_params(axis='y', labelcolor='r')
ax2.set_ylim(60, 90)

# 标注最优值
plt.axvline(x=0.2, color='g', linestyle='--', alpha=0.7)
plt.text(0.21, 79, r'$\gamma=0.2$: 精度80.1% | 压缩率76.3%', 
         fontsize=10, color='g')

plt.title(r'Trade-off between Accuracy and Communication under Parameter Selection Ratio $\gamma$', fontsize=14)
plt.legend(loc='lower right')
plt.grid(alpha=0.3)
plt.savefig('communication_compression_tradeoff_en.png', bbox_inches='tight')
